/**
 * 
 */
package com.scaffold.upload;

import wangjg.commons.io.FilePathHelper;

import com.oreilly.servlet.multipart.FilePart;
import com.scaffold.upload.entity.FileInfo;

/**
 * @author wangjg
 *
 */
public class FileUtil {
	
	public static FileInfo getFileInfo(FilePart filePart, String filePath){
		FileInfo fileInfo = new FileInfo();
		fileInfo.setContentType(filePart.getContentType());
		fileInfo.setFieldName(filePart.getName());
		fileInfo.setFileName(FilePathHelper.getFileName(filePath));
		fileInfo.setExtName(FilePathHelper.getExtName(fileInfo.getFileName()));
		fileInfo.setFilePath(filePath);
		fileInfo.setOriFileName(filePart.getFileName());
		return fileInfo;
	}
	
}
